/**
 * 
 */
 var context;
 var pistolSound = new Audio("WebContent/sounds/pistolSound.wav"); // buffers automatically when created
 var awpSound = new Audio("WebContent/sounds/awpSound.wav");
 var machinegunSound = new Audio("WebContent/sounds/machinegunSound.wav");
 var pumpSound = new Audio("WebContent/sounds/pumpSound.wav");
	var clipIn = new Audio("WebContent/sounds/clipin.wav");
	var clipOut = new Audio("WebContent/sounds/clipout.wav");
var gameOver = false;
var spawnInterval;
var levelID;
var spawnRate = 7000;
var PumpPic = new Image();
PumpPic.src = "WebContent/img/shotgun.png";
var picturee = new Image();
picturee.src = "WebContent/img/mernik.png";
var intervalNonShoot;
var impAlive = new Image();
impAlive.src = "WebContent/img/imp.png";
var impDeath = new Image();
impDeath.src = "WebContent/img/impDeath.png";
var hell = new Image();
hell.src = "WebContent/img/hell.jpg";
var interval;
var x, y;
var player = new Player();
var pistol = new Image();
pistol.src = "WebContent/img/pistol.png";
var baronAlive = new Image();
baronAlive.src = "WebContent/img/baron.png";
var demonAlive = new Image();
demonAlive.src = "WebContent/img/demon.png";
var cyborgAlive = new Image();
cyborgAlive.src = "WebContent/img/cyborg.png";
var baronDeath = new Image();
baronDeath.src = "WebContent/img/baronDeath.png";
var demonDeath = new Image();
demonDeath.src = "WebContent/img/demonDeath.png";
var cyborgDeath = new Image();
cyborgDeath.src = "WebContent/img/cyborgDeath.png";
var homerAlive = new Image();
homerAlive.src = "WebContent/img/homerAlive.png";
var homerDeath = new Image();
homerDeath.src = "WebContent/img/homerDeath.png";
var level1Load = new Image();
level1Load.src = "WebContent/img/level1background.jpg";
var level1Back = new Image();
level1Back.src = "WebContent/img/level1font.jpg";
var level2Load = new Image();
level2Load.src = "WebContent/img/level2background.jpg";
var level2Back = new Image();
level2Back.src = "WebContent/img/level2font.jpg";
var level3Load = new Image();
level3Load.src = "WebContent/img/level3background.jpg";
var level3Back = new Image();
level3Back.src = "WebContent/img/level3font.png";
var level4Load = new Image();
level4Load.src = "WebContent/img/hellGate.jpg";
var level4Back = new Image();
level4Back.src = "WebContent/img/hell2.jpg";
monsters = new Array();
var main;
$(document).ready(function() {

	addButtons();
});
addButtons = function() {
	$('.button').remove();
	$('.menuText').remove();
	$("<p/>").addClass("button").text("START").appendTo("#gameWindow").click(
			function() {

				$("#gameWindow").remove();
				a = new Game();

				console.log(spawnRate);
				player.weapons = [ new Pistol() ];
				a.levelStart(a.levels[a.currentLevel]);
			});

	$("<p/>").addClass("button").text("INSTRUCTIONS").appendTo("#gameWindow")
			.click(showInstructions);
};

function showInstructions() {
	$('.button').remove();
	$("<p/>").addClass("menuText").text("GL & HF").appendTo("#gameWindow");
	$("<p/>").addClass("button").text("BACK").appendTo("#gameWindow").click(
			addButtons);
}
